package com.hk.dto;

import com.hk.model.User;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

/**
 * @Author xuebinlu
 * @Date 2018/6/25 16:36
 * @Version 1.0
 * @Description 注册用户dto
 **/
@Data
public class RegisterUser implements Serializable {

    private static final long serializable = 1L;

    @NotBlank
    @Length(min = 1,max = 50,message = "字符串长度大于1,小于50")
    private String email;

    @NotBlank
    @Length(min = 11,max = 11,message = "请输入11位手机号码")
    private String telephone;

    @NotBlank
    @Length(min = 1,max = 20,message = "字符串长度大于1,小于8")
    private String username;

    @NotBlank
    @Length(min = 1,max = 50,message = "字符串长度大于1,小于50")
    private String loginName;//登录名

    @NotBlank
    @Length(min = 1,max = 20,message = "字符串长度大于1,小于20")
    private String password;//登录密码

    public User cloneDataToUser(){
        User user = new User();
        user.setEmail(getEmail());
        user.setUsername(getUsername());
        user.setPassword(getPassword());
        user.setTelephone(getTelephone());
        user.setLoginName(getLoginName());
        return user;
    }
}
